/*
 * Copyright (c)  2015~2020, xforceplus
 * All rights reserved.
 * Project:datacare-orm
 * Id: OrmSqlResultListener.java   2020-10-10 22-10-00
 * Author: Evan
 */
package cn.datacare.orm.mapping.orm;

import cn.datacare.orm.manager.Manager;
import cn.datacare.orm.manager.impl.SQLManager;
import cn.datacare.orm.source.SQLResult;
import cn.datacare.orm.source.SQLResultListener;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * Title:
 * </p>
 * <p>
 * Description:
 * </p>
 * <p>
 * Copyright: 2015~2020
 * </p>
 * <p>
 * Company/Department: xforceplus
 * </p>
 *
 * @author Evan
 * <b>Creation Time:</b> 2020-10-10 22-10-00
 * @since V1.0
 */
public class OrmSqlResultListener implements SQLResultListener {

    List<MappingEntity> mappingEntities = new ArrayList<>(3);


    public List<MappingEntity> getMappingEntities() {
        return mappingEntities;
    }

    public void setMappingEntities(List<MappingEntity> mappingEntities) {
        this.mappingEntities = mappingEntities;
    }

    @Override
    public List dataSelected(List list, Map<String, Object> paras, Manager sqlManager, SQLResult sqlResult) {
        for (MappingEntity mapConfig : mappingEntities) {
            mapConfig.map(list, sqlManager, paras);
        }
        return list;
    }
}
